<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>已支付订单</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="Author" content="larry" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <link rel="stylesheet" type="text/css" href="/static/admin/common/layui/css/layui.css" media="all">
    <link rel="stylesheet" type="text/css" href="/static/admin/backstage/css/base.css" media="all">
    <link rel="stylesheet" type="text/css" href="/static/admin/common/css/animate.css" media="all">
    <link rel="stylesheet" type="text/css" href="/static/admin/backstage/css/admin.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <div class="larry-container larryms-admin">
        <div class="layui-row layui-col-space20">
            <div class="layui-col-xs12 animated fadeInRightBig">
                <section class="larry-panel">
                    <div class="larryms-page-header">
                        <span class="tit">已支付订单</span>
                    </div>
                    <div class="larryms-page-body">
                        <form class="layui-form">
                            <table class="layui-table">
                                <thead>
                                <tr>
                                    <th>id</th>
                                    <th>订单编号</th>
                                    <th>用户名</th>
                                    <th>支付方式</th>
                                    <th>商品价格</th>
                                    <th>下单时间</th>
                                    <th>付款时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                {volist name="list" id="vo"}
                                <tr>
                                    <td>{$vo.order_id}</td>
                                    <td>{$vo.order_sn}</td>
                                    <td>{$vo.nickname}</td>
                                    <td>
                                        {if condition="$vo.pay_code eq 'weixin'"}微信支付
                                        {else /} 其他支付方式
                                        {/if}
                                    </td>
                                    <td>{$vo.goods_price}</td>
                                    <td>{$vo.add_time|date="Y-m-d h:i:s",###}</td>
                                    <td>{$vo.pay_time|date="Y-m-d h:i:s",###}</td>
                                    <td>
                                        <div class="layui-btn-group">
                                            <a class="layui-btn layui-btn-primary layui-btn-sm" href="javascript:void(0);" onclick="orderDel(this, '{$vo.order_id}')"><i class="layui-icon"></i></a>
                                        </div>
                                    </td>
                                </tr>
                                {/volist}
                                <tr>
                                    <td colspan="9"><div id="user" style="float: right" class="layui-box layui-laypage layui-laypage-default">{$list->render()}</div></td>
                                </tr>
                                </tbody>
                            </table>
                        </form>
                    </div>
                </section>
            </div>
        </div>
    </div>
</div>
<!-- 加载js文件-->
<script type="text/javascript" src="/static/admin/common/layui/layui.js"></script>
</body>
<script>
    var $,layer;
    layui.use([ 'layer'], function(){
        $ = layui.$;    //重点处
        layer = layui.layer;

    });
    layui.use(['form', 'layer','jquery'], function(){
        var form = layui.form;
        var $,layer;
        $ = layui.$;    //重点处
        layer = layui.layer;
        //修改状态
        $(".layui-form-switch").click(function(){
            var status_edit = $(this).parent().find("input").attr('data-id');
            $.ajax({
                type:"POST",
                url:"{:url('admin/order/status_edit')}",
                dataType:"JSON",
                data:{'order_id':status_edit},
                success:function(data){
                    if(data.code == '1'){
                        layer.msg(data.msg, {icon: 5});
                        //console.log(data.code);
                    }else{
                        layer.msg(data.msg, {icon: 6});
                    }
                }
            });
        });
    });
    //删除友链
    function orderDel(obj,orderDel){
        if(obj && orderDel){
            $.ajax({
                type:"POST",
                url:"{:url('admin/order/orderDel')}",
                dataType:"JSON",
                data:{'order_id':orderDel},
                success:function(data){
                    // console.log(data.code);
                    if(data.code == '1'){
                        layer.msg(data.msg, {icon: 6});
                        $(obj).parents('tr').remove();
                        //console.log(data.code);
                    }else if(data.code == '-1'){
                        layer.msg(data.msg, {icon: 5});
                    }
                }
            });
        }
    }
</script>
</html>